package com.xp.basic.filedemo;

import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;

public class TestFiels {

    public static void main(String[] args) throws IOException {
        Files.walkFileTree(Path.of("C:\\Program Files"),new SimpleFileVisitor<Path>(){
            /**
             * Invoked for a file that could not be visited.
             *
             * <p> Unless overridden, this method re-throws the I/O exception that prevented
             * the file from being visited.
             *
             * @param file
             * @param exc
             */
            @Override
            public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
                return super.visitFileFailed(file, exc);
            }

            /**
             * Invoked for a file in a directory.
             *
             * <p> Unless overridden, this method returns {@link FileVisitResult#CONTINUE
             * CONTINUE}.
             *
             * @param file
             * @param attrs
             */
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                return super.visitFile(file, attrs);
            }
        });
        Files.walk(Paths.get("C:\\Program Files"),FileVisitOption.FOLLOW_LINKS).forEach(f->{

        });
    }
}
